package com.briup.app01.dao;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.briup.app01.bean.Customer;

public interface CustomerMapper {
	
	@Insert("insert into cst_customer(cust_id,cust_name,cust_region)"
			+ "values(#{custId},#{custName},#{custRegion})")
	public void save(Customer customer);
	
	@Delete("delete from cst_customer where cust_id=#{i}")
	public void deleteById(int Id);

	
	@Update("update cst_customer set cust_name=#{custName},"
			+ "cust_region=#{custRegion},"
			+ "cust_level_label=#{custLevelLable} "
			+ "where cust_id=#{custId}")
	public  void update(Customer customer);
	
	@Select("select * from cst_customer where cust_id=#{id}")
	//表中的字段和类中的属性需要对应起来
	@Results({
		@Result(column ="cust_id",property ="custId"),
		@Result(column = "cust_name",property = "custName"),
		@Result(column = "cust_region",property = "custRegion")
	})
	public Customer selectById(int id);
	@Select("select * from cst_customer") 
	@Results({
		@Result(column ="cust_id",property ="custId"),
		@Result(column = "cust_name",property = "custName"),
		@Result(column = "cust_region",property = "custRegion")
	})
	public List<Customer> selectAll();
	
	
	
	
}